package com.longrise.android.byjk.model;


import android.graphics.Bitmap;
import android.text.TextUtils;

import com.longrise.android.byjk.plugins.dealsituation.course.video2.params.Constants;
import com.longrise.common.datasource.local.sp.CacheUtils;

public class UserInfor {

    /**
     * 保存用户信息
     */
    private final static String SP_NAME = "bbt_userInfo";
    private static final UserInfor mUserInfor = new UserInfor();

    private UserInfor() {

    }

//    public static UserInfor getInstance() {
//        if (mUserInfor == null) {
//            synchronized (UserInfor.class) {
//                if (mUserInfor == null) {
//                    mUserInfor = new UserInfor();
//                }
//            }
//        }
//        return mUserInfor;
//    }

    public static UserInfor getInstance() {
        return mUserInfor;
    }

    public final String UN_WXSTATE = "";   //微信未绑定

    public final int _WXSTATE = 1;   //微信已绑定

    private String userHeadIcon; // 头像地址

    private String userName; // 用户姓名

    private String vfcode; // 忘记密码的 验证码

    private String usersfzh; // 身份证号

    private String userphone; // 手机号码

    private String userworkareaname; // 工作地区

    private String usercomp; // 工作机构

    private String wenxinstatus; // 微信 0未绑定 1已绑定

    private String wjmmzh;//忘记密码页面用户填写的身份证号或者账号

    private String userid; //用户id 登陆时获取

    public final String APP_ID = "wx6f836b4acd094bd1";    //wx4868b35061f87885 //wx10b34c1a2862053a

    //微信秘钥
    public final String secret = "710b586b974840c82deebe516deb4b64";

    //微信用户名
    private String mWXName = "";   //设置页面中使用

    private String personname; //真实姓名

    private String weixinnickname;  //微信昵称\

    //通过这个判断usersfzh 是否为真的身份证号 1 是  0 否
    private String isRealCardNo = "";

    private String cardtype; //证件类型


    private String cardtypename; //证件类型名称

    private String managerzoneno; //管辖区域

    private int vipstate; //vip状态(0未开通 1有效 2过期)
    private int viptype; //会员类型(1：普通会员 ， 2：钻石会员 ， 3：至尊会员)
    private String viptypename; //会员类型名称
    private String deadline; //截止日期
    private int remainingdays; //剩余天数
    private String isopenmobilelogin;// ("0":未开通;"1":已开通)
    private String companyname; //所属公司
    private String managerzonename; //管辖区域
    private String isindexadsshow; //"1"显示开屏广告 "0"不显示
    private String requestpassword; //请求的密码 只有登录的时候设置 注册 手机号的都不设置

    private Bitmap bitmap;  //头像转bitmap

    /**
     * 展业秀需要分享出去的url
     */
    private String url;


    public String getRequestpassword() {
        return requestpassword;
    }

    public void setRequestpassword(String requestpassword) {
        this.requestpassword = requestpassword;
    }

    public String getIsindexadsshow() {
        return isindexadsshow;
    }

    public void setIsindexadsshow(String isindexadsshow) {
        this.isindexadsshow = isindexadsshow;
    }

    public String getCompanyname() {
        return TextUtils.isEmpty(companyname) ? CacheUtils.getString(Constants.UserInfor.COMPANYNAME) : companyname;
    }

    public void setCompanyname(String companyname) {
        this.companyname = companyname;
        CacheUtils.setString(Constants.UserInfor.COMPANYNAME, companyname);
    }

    public String getManagerzonename() {
        return TextUtils.isEmpty(managerzonename) ? CacheUtils.getString(Constants.UserInfor.MANAGERZONENAME) : managerzonename;
    }

    public void setManagerzonename(String managerzonename) {
        this.managerzonename = managerzonename;
        CacheUtils.setString(Constants.UserInfor.MANAGERZONENAME, managerzonename);
    }

    public String getIsopenmobilelogin() {
        return TextUtils.isEmpty(isopenmobilelogin) ? CacheUtils.getString(Constants.UserInfor.IS_OPENMOBILELOGIN, "0") : isopenmobilelogin;
    }

    public void setIsopenmobilelogin(String isopenmobilelogin) {
        this.isopenmobilelogin = isopenmobilelogin;
        CacheUtils.setString(Constants.UserInfor.IS_OPENMOBILELOGIN, isopenmobilelogin);
    }

    public int getVipstate() {
        return vipstate == 0 ? CacheUtils.getInt(Constants.UserInfor.USER_VIPSTATE, 0) : vipstate;
    }

    public void setVipstate(int vipstate) {
        this.vipstate = vipstate;
        CacheUtils.setInt(Constants.UserInfor.USER_VIPSTATE, vipstate);
    }

    public int getViptype() {
        return viptype == 0 ? CacheUtils.getInt(Constants.UserInfor.USER_VIPTYPE, 0) : viptype;
    }

    public void setViptype(int viptype) {
        this.viptype = viptype;
        CacheUtils.setInt(Constants.UserInfor.USER_VIPTYPE, viptype);
    }

    public String getViptypename() {
        return TextUtils.isEmpty(viptypename) ? CacheUtils.getString(Constants.UserInfor.USER_VIPTYPENAME) : viptypename;
    }

    public void setViptypename(String viptypename) {
        this.viptypename = viptypename;
        CacheUtils.setString(Constants.UserInfor.USER_VIPTYPENAME, viptypename);
    }

    public String getDeadline() {
        return TextUtils.isEmpty(deadline) ? CacheUtils.getString(Constants.UserInfor.USER_DEADLINE) : deadline;
    }

    public void setDeadline(String deadline) {
        this.deadline = deadline;
        CacheUtils.setString(Constants.UserInfor.USER_DEADLINE, deadline);
    }

    public int getRemainingdays() {
        return remainingdays == 0 ? CacheUtils.getInt(Constants.UserInfor.USER_REMAININGDAYS, 0) : remainingdays;
    }

    public void setRemainingdays(int remainingdays) {
        this.remainingdays = remainingdays;
        CacheUtils.setInt(Constants.UserInfor.USER_REMAININGDAYS, remainingdays);
    }

    public String getManagerzoneno() {
        return managerzoneno;
    }

    public void setManagerzoneno(String managerzoneno) {
        this.managerzoneno = managerzoneno;
    }


    public String getCardtype() {
        return TextUtils.isEmpty(cardtype) ? CacheUtils.getString(Constants.UserInfor.CARD_TYPE) : cardtype;
    }

    public void setCardtype(String cardtype) {
        this.cardtype = cardtype;
        CacheUtils.setString(Constants.UserInfor.CARD_TYPE, cardtype);
    }

    public String getCardtypename() {
        return TextUtils.isEmpty(cardtypename) ? CacheUtils.getString(Constants.UserInfor.CARD_TYPEE_NAME) : cardtypename;

    }

    public void setCardtypename(String cardtypename) {
        this.cardtypename = cardtypename;
        CacheUtils.setString(Constants.UserInfor.CARD_TYPEE_NAME, cardtypename);
    }

    public String getIsRealCardNo() {
        return TextUtils.isEmpty(isRealCardNo) ? CacheUtils.getString(Constants.UserInfor.IS_REAL_CARDNO) : isRealCardNo;
    }

    public void setIsRealCardNo(String isRealCardNo) {
        this.isRealCardNo = isRealCardNo;
        CacheUtils.setString(Constants.UserInfor.IS_REAL_CARDNO, isRealCardNo);
    }


    public String getmWXName() {
        return mWXName;
    }

    public void setmWXName(String mWXName) {
        this.mWXName = mWXName;
    }

    public String getWeixinnickname() {
        return TextUtils.isEmpty(weixinnickname) ? CacheUtils.getString(Constants.UserInfor.WEIXIN_NICKNAME) : weixinnickname;
    }

    public void setWeixinnickname(String weixinnickname) {
        this.weixinnickname = weixinnickname;
        CacheUtils.setString(Constants.UserInfor.WEIXIN_NICKNAME, weixinnickname);
    }

    /**
     * @return the personname
     */
    public String getPersonname() {
        return TextUtils.isEmpty(personname) ? CacheUtils.getString(Constants.UserInfor.PSERSION_NAME) : personname;
    }

    /**
     * @param personname the personname to set
     */
    public void setPersonname(String personname) {
        this.personname = personname;
        CacheUtils.setString(Constants.UserInfor.PSERSION_NAME, personname);
    }

    /**
     * @return the userid
     */
    public String getUserid() {
        return TextUtils.isEmpty(userid) ? CacheUtils.getString(Constants.UserInfor.USER_ID) : userid;

    }

    /**
     * @param userid the userid to set
     */
    public void setUserid(String userid) {
        this.userid = userid;
        CacheUtils.setString(Constants.UserInfor.USER_ID, userid);
    }

    /**
     * @return the wjmmzh
     */
    public String getWjmmzh() {
        return wjmmzh;
    }

    /**
     * @param wjmmzh the wjmmzh to set
     */
    public void setWjmmzh(String wjmmzh) {
        this.wjmmzh = wjmmzh;
    }

    /**
     * @return the vfcode
     */
    public String getVfcode() {
        return vfcode;
    }

    /**
     * @param vfcode the vfcode to set
     */
    public void setVfcode(String vfcode) {
        this.vfcode = vfcode;
    }

    /**
     * @return the usersfzh
     */
    public String getUsersfzh() {
        return TextUtils.isEmpty(usersfzh) ? CacheUtils.getString(Constants.UserInfor.USER_SFZH) : usersfzh;
    }

    /**
     * @param usersfzh the usersfzh to set
     */
    public void setUsersfzh(String usersfzh) {
        this.usersfzh = usersfzh;
        CacheUtils.setString(Constants.UserInfor.USER_SFZH, usersfzh);
    }

    /**
     * @return the userphone
     */
    public String getUserphone() {
        return TextUtils.isEmpty(userphone) ? CacheUtils.getString(Constants.UserInfor.USER_PHONE) : userphone;
    }

    /**
     * @param userphone the userphone to set
     */
    public void setUserphone(String userphone) {
        this.userphone = userphone;
        CacheUtils.setString(Constants.UserInfor.USER_PHONE, userphone);
    }

    /**
     * @return the userworkareaname
     */
    public String getUserworkareaname() {
        return userworkareaname;
    }

    /**
     * @param userworkareaname the userworkareaname to set
     */
    public void setUserworkareaname(String userworkareaname) {
        this.userworkareaname = userworkareaname;
    }

    /**
     * @return the usercomp
     */
    public String getUsercomp() {
        return usercomp;
    }

    /**
     * @param usercomp the usercomp to set
     */
    public void setUsercomp(String usercomp) {
        this.usercomp = usercomp;
    }

    /**
     * @return the wenxinstatus
     */
    public String getWenxinstatus() {
        return TextUtils.isEmpty(wenxinstatus) ? CacheUtils.getString(Constants.UserInfor.WEIXIN_STATUS) : wenxinstatus;
    }

    /**
     * @param wenxinstatus the wenxinstatus to set
     */
    public void setWenxinstatus(String wenxinstatus) {
        this.wenxinstatus = wenxinstatus;
        CacheUtils.setString(Constants.UserInfor.WEIXIN_STATUS, wenxinstatus);
    }

    public void setUserHeadIcon(String userHeadIcon) {
        this.userHeadIcon = userHeadIcon;
        CacheUtils.setString(Constants.UserInfor.USER_HEAD_ICION, userHeadIcon);
    }

    public String getUserHeadIcon() {
        return TextUtils.isEmpty(userHeadIcon) ? CacheUtils.getString(Constants.UserInfor.USER_HEAD_ICION) : userHeadIcon;
    }

    public void setUserName(String userName) {
        this.userName = userName;
        CacheUtils.setString(Constants.UserInfor.USER_NAME, userName);
    }

    public String getUserName() {
        return TextUtils.isEmpty(userName) ? CacheUtils.getString(Constants.UserInfor.USER_NAME) : userName;
    }

    /**
     * */
    private String userNickName;

    public void setUserNickName(String userNickName) {
        this.userNickName = userNickName;
        CacheUtils.setString(Constants.UserInfor.USER_NICK_NAME, userNickName);
    }

    public String getUserNickName() {
        return TextUtils.isEmpty(userNickName) ? CacheUtils.getString(Constants.UserInfor.USER_NICK_NAME) : userNickName;
    }

    private String userZYXX;  //执业证

    public void setUserZYXX(String userZYXX) {
        this.userZYXX = userZYXX;
        CacheUtils.setString(Constants.UserInfor.USER_ZYXX, userZYXX);
    }

    public String getZYXX() {
        return TextUtils.isEmpty(userZYXX) ? CacheUtils.getString(Constants.UserInfor.USER_ZYXX) : userZYXX;
    }

    private String userProfile;  //个人简介

    public void setUserProfile(String userProfile) {
        this.userProfile = userProfile;
        CacheUtils.setString(Constants.UserInfor.USER_PROFILE, userProfile);
    }

    public String getUserProfile() {
        return TextUtils.isEmpty(userProfile) ? CacheUtils.getString(Constants.UserInfor.USER_PROFILE) : userProfile;
    }


    private String userCPZS;  //产品展示

    public void setUserCPZS(String userCPZS) {
        this.userCPZS = userCPZS;
        CacheUtils.setString(Constants.UserInfor.USER_CPZS, userCPZS);
    }

    public String getUserCPZS() {
        return TextUtils.isEmpty(userCPZS) ? CacheUtils.getString(Constants.UserInfor.USER_CPZS) : userCPZS;
    }

    private String userGRRY;  //个人荣誉

    public void setUserGRRY(String userGRRY) {
        this.userGRRY = userGRRY;
        CacheUtils.setString(Constants.UserInfor.USER_GRRY, userGRRY);
    }


    public String getUserGRRY() {
        return TextUtils.isEmpty(userGRRY) ? CacheUtils.getString(Constants.UserInfor.USER_GRRY) : userGRRY;
    }

    private String isecardvip;    //是否是付费用户

    public void setIsecardvip(String isecardvip) {
        this.isecardvip = isecardvip;
        CacheUtils.setString(Constants.UserInfor.USER_CARD_VIP, isecardvip);
    }


    public String getIsecardvip() {
        return TextUtils.isEmpty(isecardvip) ? CacheUtils.getString(Constants.UserInfor.USER_CARD_VIP) : isecardvip;
    }


    private String wechatimgurl;   //微信地址

    public void setWechatimgurl(String wechatimgurl) {
        this.wechatimgurl = wechatimgurl;
        CacheUtils.setString(Constants.UserInfor.USER_WX_URL, wechatimgurl);
    }

    public String getWechatimgurl() {
        return TextUtils.isEmpty(wechatimgurl) ? CacheUtils.getString(Constants.UserInfor.USER_WX_URL) : wechatimgurl;
    }

    private boolean isauthorised;  //账号是否认证(姓名和身份证填写完整),

    public void setIsauthorised(boolean isauthorised) {
        this.isauthorised = isauthorised;
        CacheUtils.setBoolean(Constants.UserInfor.USER_ISAUTOORISED, isauthorised);
    }

    public boolean getIsauthorised() {
        return isauthorised;
    }

    public Bitmap getBitmap() {
        return bitmap;
    }

    public void setBitmap(Bitmap bitmap) {
        this.bitmap = bitmap;
    }

    /**
     * 展业秀地址
     */
    public String getUrl() {
        return TextUtils.isEmpty(url) ? CacheUtils.getString(Constants.UserInfor.ZYXURL) : url;
    }

    /**
     * 设置展业秀地址
     */
    public void setUrl(String url) {
        this.url = url;
        CacheUtils.setString(Constants.UserInfor.ZYXURL, url);
    }

}
